package cn.stylefeng.guns.modular.forecastLoadInformation.controller;

import cn.stylefeng.guns.modular.forecastLoadInformation.entity.QyuanPowerSdGridForecast;
import cn.stylefeng.guns.modular.forecastLoadInformation.pojo.request.QyuanPowerSdGridForecastRequest;
import cn.stylefeng.guns.modular.forecastLoadInformation.service.QyuanPowerSdGridForecastService;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 负荷信息预测信息表，记录每天96个时间点的电网运行预测数据控制器
 *
 * @author 我是谭先生🐻
 * @date 2025/03/14 10:41
 */
@RestController
@ApiResource(name = "负荷信息预测信息表，记录每天96个时间点的电网运行预测数据")
public class QyuanPowerSdGridForecastController {

    @Resource
    private QyuanPowerSdGridForecastService qyuanPowerSdGridForecastService;

    /**
     * 添加
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 10:41
     */
    @PostResource(name = "添加", path = "/qyuanPowerSdGridForecast/add")
    public ResponseData<QyuanPowerSdGridForecast> add(@RequestBody @Validated(QyuanPowerSdGridForecastRequest.add.class) QyuanPowerSdGridForecastRequest qyuanPowerSdGridForecastRequest) {
        qyuanPowerSdGridForecastService.add(qyuanPowerSdGridForecastRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 删除
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 10:41
     */
    @PostResource(name = "删除", path = "/qyuanPowerSdGridForecast/delete")
    public ResponseData<?> delete(@RequestBody @Validated(QyuanPowerSdGridForecastRequest.delete.class) QyuanPowerSdGridForecastRequest qyuanPowerSdGridForecastRequest) {
        qyuanPowerSdGridForecastService.del(qyuanPowerSdGridForecastRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 10:41
     */
    @PostResource(name = "编辑", path = "/qyuanPowerSdGridForecast/edit")
    public ResponseData<?> edit(@RequestBody @Validated(QyuanPowerSdGridForecastRequest.edit.class) QyuanPowerSdGridForecastRequest qyuanPowerSdGridForecastRequest) {
        qyuanPowerSdGridForecastService.edit(qyuanPowerSdGridForecastRequest);
        return new SuccessResponseData<>();
    }

    /**
     * 查看详情
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 10:41
     */
    @GetResource(name = "查看详情", path = "/qyuanPowerSdGridForecast/detail")
    public ResponseData<QyuanPowerSdGridForecast> detail(@Validated(QyuanPowerSdGridForecastRequest.detail.class) QyuanPowerSdGridForecastRequest qyuanPowerSdGridForecastRequest) {
        return new SuccessResponseData<>(qyuanPowerSdGridForecastService.detail(qyuanPowerSdGridForecastRequest));
    }

    /**
     * 获取列表
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 10:41
     */
    @GetResource(name = "获取列表", path = "/qyuanPowerSdGridForecast/list")
    public ResponseData<List<QyuanPowerSdGridForecast>> list(QyuanPowerSdGridForecastRequest qyuanPowerSdGridForecastRequest) {
        return new SuccessResponseData<>(qyuanPowerSdGridForecastService.findList(qyuanPowerSdGridForecastRequest));
    }

    /**
     * 获取列表（带分页）
     *
     * @author 我是谭先生🐻
     * @date 2025/03/14 10:41
     */
    @GetResource(name = "分页查询", path = "/qyuanPowerSdGridForecast/page")
    public ResponseData<PageResult<QyuanPowerSdGridForecast>> page(QyuanPowerSdGridForecastRequest qyuanPowerSdGridForecastRequest) {
        return new SuccessResponseData<>(qyuanPowerSdGridForecastService.findPage(qyuanPowerSdGridForecastRequest));
    }

}
